/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       positionallight.h
 * Author:     karooolek
 * Created on: 2009-03-27
 *
 **********************************************************************************************************************/

#ifndef POSITIONALLIGHT_H_
#define POSITIONALLIGHT_H_

#include "ambientlight.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Positioned omni-directional point light.
 * It has specified color and attenuation factors.
 */
class PositionalLight : public AmbientLight
{
protected:
    /**
     * Position.
     */
    Vector3 _position;

    /**
     * Diffuse color
     */
    Color _diffuse;

    /**
     * Specular color
     */
    Color _specular;

    /**
     * Constant attenuation factor
     */
    float _constantAttenuation;

    /**
     * Linear attenuation factor
     */
    float _linearAttenuation;

    /**
     * Quadratic attenuation factor
     */
    float _quadraticAttenuation;

public:
    /**
     * Create new positional light.
     */
    PositionalLight();

    /**
     * Create new positional light with specified colors, attenuation factors
     * and position.
     * @param ambient ambient light color
     * @param diffuse diffuse light color
     * @param specular specular light color
     * @param constantAttenuation constant attenuation factor
     * @param linearAttenuation linear attenuation factor
     * @param quadraticAttenuation quadratic attenuation factor
     * @param position light position
     */
    PositionalLight(const Color &ambient, const Color &diffuse,
            const Color &specular,
            float constantAttenuation = 1.0f, float linearAttenuation = 0.0f,
            float quadraticAttenuation = 0.0f,
            const Vector3 &position = Vector3());

    /**
     * Destroy positional light.
     */
    virtual ~PositionalLight();

    /**
     * Get positional light position.
     * @return positional light position.
     */
    const Vector3 &getPosition() const
    {
        return _position;
    }

    /**
     * Set positional light position.
     * @param position position.
     */
    void setPosition(const Vector3 &position)
    {
        _position = position;
    }

    /**
     * Get positional light diffuse color.
     * @return diffuse light color
     */
    const Color &getDiffuseColor() const
    {
        return _diffuse;
    }

    /**
     * Set positional light diffuse color.
     * @param diffuse light color
     */
    void setDiffuseColor(const Color &diffuse)
    {
        _diffuse = diffuse;
    }

    /**
     * Get positional light specular color.
     * @return specular light color
     */
    const Color &getSpecularColor() const
    {
        return _specular;
    }

    /**
     * Set positional light specular color.
     * @param specular light color
     */
    void setSpecularColor(const Color &specular)
    {
        _specular = specular;
    }

    /**
     * Get positional light constant attenuation factor.
     * @return constant attenuation factor
     */
    float getConstantAttenuation() const
    {
        return _constantAttenuation;
    }

    /**
     * Set positional light constant attenuation factor.
     * @param constantAttenuation constant attenuation factor
     */
    void setConstantAttenuation(float constantAttenuation)
    {
        _constantAttenuation = constantAttenuation;
    }

    /**
     * Get positional light linear attenuation factor.
     * @return linear attenuation factor
     */
    float getLinearAttenuation() const
    {
        return _linearAttenuation;
    }

    /**
     * Set positional light linear attenuation factor.
     * @param linearAttenuation linear attenuation factor
     */
    void setLinearAttenuation(float linearAttenuation)
    {
        _linearAttenuation = linearAttenuation;
    }

    /**
     * Get positional light quadratic attenuation factor.
     * @return quadratic attenuation factor
     */
    float getQuadraticAttenuation() const
    {
        return _quadraticAttenuation;
    }

    /**
     * Set positional light quadratic attenuation factor.
     * @param quadraticAttenuation quadratic attenuation factor
     */
    void setQuadraticAttenuation(float quadraticAttenuation)
    {
        _quadraticAttenuation = quadraticAttenuation;
    }

    /**
     * Set positional light on graphics scene.
     * @param l light identifier
     */
    virtual void set(uint l) const;
};

}

}

#endif // POSITIONALLIGHT_H_
